//
//  FTBLPeripheralViewCell.m
//  FaceTo
//
//  Created by 姚冬元 on 2017/7/30.
//  Copyright © 2017年 chengbangming. All rights reserved.
//

#import "FTBLPeripheralViewCell.h"

@implementation FTBLPeripheralViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI
{
    CGFloat fontSize = iphone6p ? 15 : 14;
    
    _namelbl = [[UILabel alloc] init];
    _namelbl.text = @"用户001";
    _namelbl.textColor = FontColor;
    _namelbl.textAlignment = NSTextAlignmentLeft;
    _namelbl.font = LPFont(fontSize);
    [self addSubview:_namelbl];
    
    _statelbl = [[UILabel alloc] init];
    _statelbl.text = @"未连接";
    _statelbl.textColor = Color(210, 210, 210);
    _statelbl.textAlignment = NSTextAlignmentLeft;
    _statelbl.font = LPFont(fontSize-1);
    [self addSubview:_statelbl];
    
    _inviteBtn = [[UIButton alloc] init];
    [_inviteBtn setTitle:@"邀请" forState:UIControlStateNormal];
    [_inviteBtn setTitleColor:FontColor forState:UIControlStateNormal];
    [_inviteBtn setBackgroundColor:FTColor];
    _inviteBtn.titleLabel.font = LPFont(fontSize);
    _inviteBtn.layer.cornerRadius = 3;
    _inviteBtn.layer.masksToBounds = YES;
    [self addSubview:_inviteBtn];
    
    [_namelbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(20);
        make.centerY.equalTo(self.mas_centerY);
    }];
    
    [_statelbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_namelbl.mas_right).with.offset(30);
        make.bottom.equalTo(_namelbl.mas_bottom);
    }];
    
    [_inviteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-20);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(30);
    }];
}

@end
